{% extends 'TopxiaWebBundle::layout.html.twig' %}

{% block title %}{{ course.title }} - {{ parent() }}{% endblock %}

{% set hideSetupHint = true %}

{% if is_plugin_installed('Homework') %}
  {% set script_arguments = {customChapter: setting('course.custom_chapter_enabled')|default(true), plugins: ['lesson', 'question', 'note', 'material', 'homework']}  %}
{% else %}  
  {% set script_arguments = {customChapter: setting('course.custom_chapter_enabled')|default(true), plugins: ['lesson', 'question', 'note', 'material']}  %}
{% endif %}

{% set script_controller = 'course/learn' %}
{% set bodyClass = 'lesson-dashboard-page' %}

{% block stylesheets %}
  {{ parent() }}
  {% if setting("developer.balloon_player")|default(0) %}
    <link rel="stylesheet" media="screen" href="{{asset('assets/libs/balloon-video-player/1.0.0/src/skin/video-js-debug.css') }}" rel="stylesheet" type="text/css">
  {% endif %}
{% endblock %}

{% block header %}{% endblock %}
{% block footer %}{% endblock %}
{% block esBar %}{% endblock %}
{% block full_content %}
  <div class="lesson-dashboard" id="lesson-dashboard"
    data-course-id="{{ course.id }}"
    data-course-uri="{{ path('course_show', {id:course.id}) }}"
    data-dashboard-uri="{{ path('course_learn', {id:course.id}) }}"
    data-watch-limit="{{ setting('magic.lesson_watch_limit') }}"
    data-starttime = "{{starttime|default('')}}"
    data-hide-media-lesson-learn-btn="{{ is_feature_enabled('hide_media_lesson_learn_btn') }}">
    <div class="dashboard-content">
      {% set classroom = data('GetClassroomByCourseId',{courseId:course.id}) %}
      {% if classroom %}
        <a class="btn btn-primary  nav-btn back-course-btn" href="{{ path('classroom_show', {id:classroom.id}) }}"><span class="glyphicon glyphicon-chevron-left" ></span> 返回班级</a>
      {% else %}
        <a class="btn btn-primary  nav-btn back-course-btn" href="{{ path('course_show', {id:course.id}) }}"><span class="glyphicon glyphicon-chevron-left" ></span> 返回课程</a>
      {% endif %}
       
       <a class="btn btn-primary  nav-btn prev-lesson-btn" href="javascript:" data-role="prev-lesson" data-placement="right" title="上一课时"><span class="glyphicon glyphicon-chevron-up" title="上一课时"></span></a>
       <a class="btn btn-primary nav-btn next-lesson-btn" href="javascript:" data-role="next-lesson" data-placement="right" title="下一课时"><span class="glyphicon glyphicon-chevron-down"></span></a>

      <div class="dashboard-header">
        <div class="pull-left title-group">
          <span class="chapter-label">
            {% if not setting('course.custom_chapter_enabled')|default(true)%}
              <span data-role="custom-chapter-number">第{% if setting('default.chapter_name') %}{{setting('default.chapter_name')|default('章')}}{% else %}章{% endif %}</span></span>
            {% else %}
              第<span data-role="chapter-number"></span>{% if setting('default.chapter_name') %}{{setting('default.chapter_name')|default('章')}}{% else %}章{% endif %}</span>
            {% endif %}
          <span class="divider">&raquo;</span>
          <span class="chapter-label">
            {% if not setting('course.custom_chapter_enabled')|default(true)%}
              <span data-role="custom-unit-number">第{% if setting('default.part_name') %}{{setting('default.part_name')|default('节')}}{% else %}节{% endif %}</span></span>
            {% else %}
              第<span data-role="unit-number"></span>{% if setting('default.part_name') %}{{setting('default.part_name')|default('节')}}{% else %}节{% endif %}</span>
            {% endif %}
          <span class="divider">&raquo;</span>
          <span class="item-label">{% if  setting('course.custom_chapter_enabled')|default(true)%}课时<span data-role="lesson-number"></span>{% endif %}</span>
          <span class="item-title" data-role="lesson-title">正在加载...</span>
        </div>
      </div>

      <div class="dashboard-body">
        <div class="lesson-content" id="lesson-video-content" data-role="lesson-content" style="display:none;"
          {% if setting('storage.video_watermark') > 0 and setting('storage.video_watermark_image') %}
            data-watermark="{{ filepath(setting('storage.video_watermark_image'), null, true) }}"
          {% endif %}
          {% if setting('storage.video_fingerprint') and app.user %}
            data-fingerprint="{{ finger_print() }}"
          {% endif %}
            data-user-id="{{ app.user.id }}"
            data-balloon-player="{{ setting('developer.balloon_player')|default(0) }}"
        ></div>
        <div class="watermarkEmbedded" ></div>

        <div class="lesson-content lesson-content-audio" id="lesson-audio-content" data-role="lesson-content" style="display:none;"></div>
        <div class="lesson-content" id="lesson-swf-content" data-role="lesson-content" style="display:none;"></div>
        <div class="lesson-content" id="lesson-iframe-content" data-role="lesson-content" style="display:none;"></div>
        <div class="lesson-content lesson-content-text" id="lesson-text-content" data-role="lesson-content" style="display:none;"
        {% if setting('course.copy_enabled')|default(0) > 0 %} oncopy="return false;" oncut="return false;" onselectstart="return false" oncontextmenu="return false;"{% endif %}>
          <div class="lesson-content-text-body"></div>
        </div>

        <div class="lesson-content lesson-content-document" id="lesson-document-content" data-role="lesson-content" style="display:none;"
            {% if setting('magic.doc_watermark') %}data-watermark-url="{{ path('cloud_doc_watermark') }}" {% endif %}
          >
          <div class="lesson-content-document-body"></div>
        </div>   

        <div class="lesson-content lesson-content-text" id="lesson-live-content" data-role="lesson-content" style="display:none;">
          <div class="lesson-content-text-body"></div>
        </div>
        <div class="lesson-content lesson-content-text" id="lesson-unpublished-content" data-role="lesson-content" style="display:none;">
          <div class="lesson-content-text-body">当前课时正在编辑中，暂时无法观看。</div>
        </div>

        <div class="lesson-content lesson-content-text" id="lesson-testpaper-content" data-role="lesson-content" style="display:none;">
          <div class="lesson-content-text-body"></div>
        </div>
        <div class="lesson-content lesson-content-text" id="lesson-ppt-content" data-role="lesson-content" style="display:none;"
            {% if setting('magic.ppt_watermark') %}data-watermark-url="{{ path('cloud_ppt_watermark') }}" {% endif %}
          >
          <div class="lesson-content-text-body"></div>
        </div>

      </div>

      <div class="dashboard-footer clearfix">
        <div class="pull-right">
          <button class="btn btn-primary finish-btn" data-role="finish-lesson" style="display:none;"><span class="glyphicon glyphicon-unchecked"></span> 学过了</button>
        </div>
      </div>
    </div>

    <div class="toolbar toolbar-open" id="lesson-dashboard-toolbar">
      <div class="toolbar-nav">

        <ul class="toolbar-nav-stacked" id="lesson-toolbar-primary"></ul>
        <ul class="list-unstyled">
          <li class="es-qrcode toolbar-qrcode" data-url="{{path('course_show',{id: course.id})}}">
            <i class="es-icon es-icon-qrcode"></i><br>
            扫一扫
            <span class="qrcode-popover">
              <img src="" alt="">
              扫二维码继续学习
            </span>
          </li>
        </ul>
        <ul class="toolbar-nav-stacked" id="lesson-toolbar-secondary">
          <li class="hide-pane" style="display:none;">
            <a href="javascript:"><span class="glyphicon glyphicon-chevron-right"></span></a>
          </li>
        </ul>

      </div>
      <div class="toolbar-pane-container">
      </div>
    </div>

  </div>

  <div class="modal" id="course-learned-modal" style="display:none;">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
          <h4 class="modal-title">学习进度提示</h4>
        </div>
        <div class="modal-body">
          <p class="text-success">赞一个，这个课程你已经都学完啦，你可以再回顾一下或者去看看别的课程～～～</p>
        </div>
        <div class="modal-footer">
          <a href="{{ path('course_show', {id:course.id}) }}" class="btn btn-primary">回课程主页</a>
        </div>
      </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
  </div><!-- /.modal -->

  <div class="modal" id="mediaPlayed-control-modal" style="display:none;">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
          <h4 class="modal-title">媒体课时学习提示</h4>
        </div>
        <div class="modal-body">
          <p class="text-success">此课时设置了必须完整播放完整个课时才能学完～～</p>
        </div>
      </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
  </div><!-- /.modal -->

  <div class="modal" id="homeworkDone-control-modal" style="display:none;">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
          <h4 class="modal-title">作业未完成提示</h4>
        </div>
        <div class="modal-body">
          <p class="text-success">此课时设置了必须做完本课时作业并提交后才能学完～～</p>
        </div>
      </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
  </div><!-- /.modal -->


{% endblock %}

